<template>
	<view class="prescriptionBox" style="background-color: white;">
		<!-- <view class="search" style="display: flex;justify-content: space-between;">
			<u-search placeholder="请输入用户名或姓名搜索" v-model="keyword" height="60" searchIconSize='60'
				borderColor='#5597FB' :inputStyle="{fontSize:' 30rpx'}" @search='searchPrescription'></u-search>
			<label style="margin-left: 30rpx;width: 120rpx;">
				<u-button  type="primary" size="medium" shape="circle" @click="addUser()">新增</u-button>
			</label> 	
		</view> -->
		
		<view style="padding: 20rpx;">
			<view @click="toEdit(item)" v-for="(item,index) in dataList" :key="index" style="display: flex;justify-content: space-between;padding: 20rpx;border-bottom: 1px solid gray;">
				<view style="display: flex;justify-content: start;"><u-icon name="grid-fill" color="#5597FB" style="margin-right: 20rpx;"></u-icon>{{item.deptName}}</view>
				<view style="color: gray;">排班 ></view>
			</view>
		</view>
	</view>
</template>

<script>
	import appRequest from "@/common/appRequestUrl.js";
	export default {
		data() {
			return {
				uName:['/','管理员','患者','医生'],
				type:1,
				dataList:[],
				//处方搜索关键字
				keyword: '',
				picPath:appRequest.urlMap.getPic
			}
		},
		onLoad:function(options){
			this.type = options.type;
			this.getData();
		},
		onShow:function(){
			if(this.dataList.length!=0){
				this.getData();
			}
		},
		methods: {
			toEdit(item){
				uni.navigateTo({
					url:"EditJobPlan?id="+item.id+"&deptName="+item.deptName
				})
			},
			searchPrescription() {
				this.getData();
			},
			getData(){
				let _this = this;
				appRequest.request({
					method: "POST",
					data: {
						type:1,
						validFlag:1
						//deptName:this.keyword
					},
					url: appRequest.urlMap.findNmHospitalDeptList,
					success: function(res) {
						if(res.data.code == 200){
							_this.dataList = res.data.data;
						}else{
							_this.$api.msg(res.data.msg);
						}
					},
					fail: function(res) {
						_this.$api.msg("请求异常");
					}
				})
				
			},
			addUser(){
				uni.navigateTo({
					url:"addUser?type="+this.type
				})
			},editUser(item){
				uni.navigateTo({
					url:"addUser?uid="+item.uid
				})
			}
		}
	}
</script>
<style>
	page {
		width: 100%;
		height: 100%;
	}
</style>
<style lang="scss" scoped>
	.prescriptionBox {
		background-color: #F8F8F8;
		position: relative;

		.search {
			width: -webkit-fill-available;
			position: fixed;
			top: 0;
			background-color: #FFFFFF;
			padding: 15rpx 30rpx;
		}

		.prescriptionList {
			padding: 100rpx 30rpx 20rpx;
			background-color: #F8F8F8;

			.prescriptionItem {
				margin-top: 20rpx;
				display: flex;
				height: 176rpx;
				background-color: #FFFFFF;

				.left {
					width: 200rpx;
					height: 100%;

					.image {
						width: 100%;
						height: 100%;
					}
				}

				.right {
					width: 450rpx;
					margin-left: 24rpx;
					display: flex;
					flex-direction: column;
					justify-content: center;
					font-size: 28rpx;
					color: #8E8E8E;
					line-height: 40rpx;
						
					.name {
						font-size: 32rpx;
						line-height: 50rpx;
						color: #4B4B4B;
					}
				}
			}
		}
	}
	.u-m-r{
		margin-right: 20rpx;
	}
</style>
